Skip to main content

All Questions

3votes
1answer
2kviews

Better way of comparing two lists of dictionaries and display unique changes

Can I get a review of my code which compares 2 dictionaries and display unique changes. ...
Samuel Traxler's user avatar
10votes
2answers
8kviews

Efficient renaming of dict keys from another dict's values - Python

I have a dictionary in Python (uglyDict) that has some really un-cool key names. I would like to rename them based on values from another dictionary (...
Noah Broyles's user avatar
2votes
2answers
204views

Finding unique keys

I made the following snippet. It finds unique keys based on their values. For all keys \$s\$ that are contained in another key \$D\$ with the same value, key \$s\$ is discarded and key \$D\$ is ...
Victor Adeyemo's user avatar
7votes
1answer
1kviews

Merging two dictionaries together whilst adding keys but multiplying values

I have two dictionaries and a merged dictionary: dict1 = {-3: 0.3, -2: 0.1, 1: 0.8} dict2 = {0: 0.3, 1: 0.5, -1: 0.7} dict_merged = {} I have code that basically ...
gjdpm1's user avatar
9votes
2answers
4kviews

Better way to iterate through a dictionary and comparing its keys with itself

I have a dictionary with author names as keys and values of None. I want to use fuzzywuzzy ...
Trevor Allen's user avatar
2votes
1answer
165views

Comparing web-scraped data from several sports betting APIs

I have written a python script that requests information from several Sports Betting API's, processes and standardises the results into a dictionary, Matches items between dictionaries and then ...
Jordan's user avatar
1vote
1answer
51views

tablename alias in attribute name

I have dataframe like this: ...
elisa's user avatar
11votes
3answers
2kviews

Find the common ancestor between two nodes of a tree

Here is my code in Python for to find a common ancestor between two nodes in a particular tree. This is a question from Cracking the Coding Interview that I decided to implement on my own. No one has ...
SDG's user avatar
  • 213
1vote
1answer
242views

Search dictionary for matching values

I have a dictionary self.indexList = {} filled with 3-item-lists values = [lineId, nominalLineId, vertex] for each dictionary ...
fuzzysolutions's user avatar
4votes
1answer
305views

Finding average word length in a given year

I have written a function which takes the year in question and words as a data which is a dictionary that maps words to the list of year/count. Now I am wondering how I can improve the code that I ...
user3385538's user avatar
1vote
2answers
860views

Code to generate a dictionary from two lists

I created a script to perform a union on 2 lists: keys and words. I needed to create a dictionary from them. If there are more keys than words, missing words are replaced with "None". Any excess words ...
Tutunak's user avatar
2votes
2answers
6kviews

The efficiency of looping over nested dictionaries in Python

How to make the following code more efficient? ...
fishiwhj's user avatar

close